//
//  UserInfoViewController.m
//  FreightAssistant
//
//  Created by Mac mini on 15/12/14.
//  Copyright © 2015年 leo. All rights reserved.
//

#import "UserInfoViewController.h"

#import "LogisticsListViewController.h"

static NSString *UserInfoTableViewIdentifier = @"UserInfoTableViewIdentifier";

@interface UserInfoViewController () {
    
    NSArray *_settingTitleArray;
}

@end

@implementation UserInfoViewController

- (void)loadView {
    [super loadView];
    
    [self.tableView registerClass: [UITableViewCell class] forCellReuseIdentifier: UserInfoTableViewIdentifier];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.navigationItem.title = @"个人信息";
    _settingTitleArray = @[@"我的快递商"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _settingTitleArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier: UserInfoTableViewIdentifier forIndexPath: indexPath];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    cell.textLabel.text = _settingTitleArray[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    NSInteger row = indexPath.row;
    
    if (row == 0) {
        
        LogisticsListViewController *viewController = [LogisticsListViewController viewControllerFromStoryboard];
        
        [self.navigationController pushViewController: viewController animated: true];
//        LogisticsListViewController *viewController = [LogisticsListViewController viewControllerFromXIB];
//        [self.navigationController pushViewController: viewController animated: true];
    }
}

@end
